package com.liziba.reflect;

/**
 * <p>
 *
 * </p>
 *
 * @Author: Liziba
 * @Date: 2021/4/25 23:24
 */
public class SingletonFactory {

    private volatile static SingletonFactory singletonFactory = null;

    private SingletonFactory() {
        if(SingletonFactory.singletonFactory != null) {
            throw new RuntimeException("实例存在，无法实例化...");
        }
    }

    public static SingletonFactory getInstance() {
        if(singletonFactory == null) {
            synchronized (SingletonFactory.class) {
                if(singletonFactory == null) {
                     singletonFactory = new SingletonFactory();
                }
            }
        }
        return singletonFactory;
    }
}
